全部文档

7.5查询命令管理

提供对于命令的各种信息的查询功能。

7.5.1分页查询批量命令批次信息

功能描述:通过批次ID或属性名分页查询批量命令批次信息。

GET  /api/v1/command/multi/batch/page

Query:

Name Type Description Required
groupId int 组ID Yes
batchId string 根据批次ID过滤(不可与identifier同时传) No
identifier string 根据属性名过滤(不可与batchId同时传) No

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/command/multi/batch/page?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&groupId=100001&pageSize=10&currentPage=1' \
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
currentPage int 当前页码
pageSize int 每页条数
totalCount long 总条数
totalPage int 总页数
content struct[] 当前页内容

Response data content的子对象结构体:

Name Type Description
created string 创建时间
identifier string 属性名称
cmdType string 命令类型

Response example:

{
    "success": true,
    "code": 0,
    "msg": null,
    "data":  {
                    "content": [
                        {
                            "batchId": "abc",
                            "created": 1578391955303,
                            "identifier": "stringTest",
                            "cmdType": "propertySet"
                        },
                        {
                            "batchId": "def",
                            "created": 1578391955303,
                            "identifier": "stringTest",
                            "cmdType": "propertySet"
                        }
                    ],
                    "currentPage": 1,
                    "pageSize": 10,
                    "totalCount": 2,
                    "totalPage": 1
               }
}

7.5.2分页查询批量命令的结果

功能描述:根据批次ID等信息分页查询批量命令结果

GET  /api/v1/command/multi/result/page

Query:

Name Type Description Required
groupId int 组ID Yes
deviceName string 设备名称 No
batchId string 根据批次ID过滤(不可与identifier同时传) Yes
result int 命令结果:1-执行中,3-成功,4-失败 No

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/command/multi/result/page?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&groupId=100001&batchId=110&pageSize=10&currentPage=1' \
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
currentPage int 当前页码
pageSize int 每页条数
totalCount long 总条数
totalPage int 总页数
content struct[] 当前页内容

Response data content的子对象结构体:

Name Type Description
commandId string 命令ID
groupId int 分组ID
batchId string 批次ID
productId int 产品ID
deviceId int 设备ID
deviceName string 设备名称
cmdType string 命令类型:propertySet或propertyGet或propertyExecute
protocol int 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA)
identifier string 属性名称
value object 属性值
created long 创建时间
modified long 更新时间
result int 命令执行结果:0-等待,3-成功,4-失败
msg string 错误信息
devRespCode string 设备返回的错误码
devRespMsg string 设备返回的错误信息

Response example:

{
    "success": true,
    "code": 0,
    "msg": null,
    "data": {
                    "content": [
                        {
                            "commandId": "b53dad57-577c-4a14-a0ed-03a72cbe59ad",
                            "groupId": 57,
                            "batchId": "def",
                            "productId": 100106,
                            "deviceId": 10000338,
                            "deviceName": "multi_dev_3",
                            "cmdType": "propertySet",
                            "protocol": 1,
                            "identifier": "stringTest",
                            "value": null,
                            "created": 1578391955303,
                            "modified": 1578391955448,
                            "result": 3,
                            "msg": ""
                        }
                    ],
                    "currentPage": 1,
                    "pageSize": 10,
                    "totalCount": 1,
                    "totalPage": 1
                }
}

7.5.3查询批量命令的统计信息

功能描述:根据批次ID查询批量命令的统计信息

GET  /api/v1/command/multi/statistics/info

Query:

Name Type Description Required
groupId int 组ID Yes
batchId string 批次ID Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/command/multi/statistics/info?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&groupId=100001&batchId=110' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \

Response data:

Name Type Description
batchId String 批次ID
identifier String 属性名称
cmdType String 命令类型:propertySet或propertyGet或propertyExecute
created long 创建时间
succeed int 命令状态:成功
failed int 命令状态:失败
waiting int 命令状态:等待

Response example:

{
    "success": true,
    "code": 0,
    "msg": null,
    "data": {
        "batchId":"abc",
        "identifier":"testInt",
        "cmdType":"propertySet",
        "created":1578391955303,
        "succeed":1,
        "failed":0,
        "waiting":0
    }
}

7.5.4获取设备异步命令

功能描述:获取设备异步命令列队中的指定命令。返回字段中的result字段表示该命令的执行状态,对应的值,0:wait (等待中); 3 : succeed(成功) ;4 :failed(失败)。当命令执行成功后,value字段返回改命令的执行值。

GET /api/v1/commands-async/{commandId}

Path:

Name Type Description Required
commandId string 命令ID Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/commands-async/b53dad57-577c-4a14-a0ed-03a72cbe59ad?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \

Response data:

Name Type Description
commandId string 命令ID
groupId int 分组ID
batchId string 批次ID
productId int 产品ID
deviceId int 设备ID
deviceName string 设备名称
cmdType string 命令类型:propertySet或propertyGet或propertyExecute
protocol int 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA)
identifier string 属性名称
value object 属性值
created long 创建时间
modified long 更新时间
result int 命令执行结果:0-等待,3-成功,4-失败
msg string 错误信息
devRespCode string 设备返回的错误码
devRespMsg string 设备返回的错误信息

Response example:

{
  "success": true,
  "code": 0,
  "msg": "",
    "data": {
        "eventId": null,
        "deviceId": 10000196,
        "productId": 100316,
        "protocol": 4,
        "name": null,
        "value": 1,
        "created": 1574237516859,
        "origin": null,
        "result": 3,
        "modified": 1574237517022,
        "identifier": "led_light",
        "cmdType": "propertySet",
        "deviceName": "MODBUD_D_1",
        "msg": "",
        "comandId": null
    },
}

7.5.5分页查询设备异步命令

功能描述:分页查询设备异步命令,返回具体分页信息和命令信息列表。

GET /api/v1/commands-async

Query

Name Type Description Required
deviceId int 设备ID Yes
start int 起始时间戳(毫秒级时间戳) No
end int 结束时间戳(毫秒级时间戳) No
identifier string 设备属性 No
pageSize int 分页大小 Yes
currentPage int 页码 Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/commands-async?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&deviceId=100001&pageSize=10&currentPage=1' \
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
currentPage int 当前页码
pageSize int 每页条数
totalCount long 总条数
totalPage int 总页数
content struct[] 当前页内容

Response data content的子对象结构体:

Name Type Description
commandId string 命令ID
groupId int 分组ID
batchId string 批次ID
productId int 产品ID
deviceId int 设备ID
deviceName string 设备名称
cmdType string 命令类型:propertySet或propertyGet或propertyExecute
protocol int 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA)
identifier string 属性名称
value object 属性值
created long 创建时间
modified long 更新时间
result int 命令执行结果:0-等待,3-成功,4-失败
msg string 错误信息
devRespCode string 设备返回的错误码
devRespMsg string 设备返回的错误信息

Response example:

{
  "success": true,
  "code": 0,
  "msg": "",
  "data": {
    "totalCount": 1,
    "pageSize": 5,
    "currentPage": 1,
    "totalPage": 1,
    "content": [
      {
        "id": "5d5154dea9ab4f00012472a6",
        "type": 1
        "deviceId": 10000115,
        "propertyName": "string",
        "value": "50",
        "retry": 0,
        "executeCount": 0,
        "expiredTime": 100000000,
        "createTime": 1565611230481,
        "sendStatus": 0
      }
    ]
  }
}

results matching ""

    No results matching ""